<template>
  <div class="login-container">
    <div class="login-box">
      <div class="login-header">
        <h2>{{ isDoctor ? '医生登录系统' : '管理员登录系统' }}</h2>
        <p>{{ isDoctor ? '请使用您的医生账号登录' : '请使用您的管理员账号登录' }}</p>
        
        <!-- 切换按钮 -->
        <div class="switch-container">
          <el-button
            :type="!isDoctor ? 'primary' : 'default'"
            size="small"
            @click="switchToAdmin"
          >
            管理员
          </el-button>
          <el-button
            :type="isDoctor ? 'primary' : 'default'"
            size="small"
            @click="switchToDoctor"
          >
            医生
          </el-button>
        </div>
      </div>
      
      <!-- 医生登录表单 -->
      <div v-if="isDoctor">
        <el-tabs v-model="activeTab" class="login-tabs" @tab-change="handleTabChange">
          <el-tab-pane label="登录" name="login">
            <el-form
              ref="doctorLoginFormRef"
              :model="doctorLoginForm"
              :rules="doctorLoginRules"
              class="login-form"
              @submit.prevent="handleDoctorLogin"
            >
              <el-form-item prop="username">
                <el-input
                  v-model="doctorLoginForm.username"
                  placeholder="请输入用户名"
                  prefix-icon="User"
                  size="large"
                />
              </el-form-item>
              
              <el-form-item prop="password">
                <el-input
                  v-model="doctorLoginForm.password"
                  type="password"
                  placeholder="请输入密码"
                  prefix-icon="Lock"
                  size="large"
                  show-password
                  @keyup.enter="handleDoctorLogin"
                />
              </el-form-item>
              
              <el-form-item>
                <el-button
                  type="primary"
                  size="large"
                  class="login-button"
                  :loading="loading"
                  @click="handleDoctorLogin"
                >
                  登录
                </el-button>
              </el-form-item>
            </el-form>
          </el-tab-pane>
          
          <el-tab-pane label="注册" name="register">
            <el-form
              ref="doctorRegisterFormRef"
              :model="doctorRegisterForm"
              :rules="doctorRegisterRules"
              class="login-form"
              @submit.prevent="handleDoctorRegister"
            >
              <el-form-item prop="username">
                <el-input
                  v-model="doctorRegisterForm.username"
                  placeholder="请输入用户名 (长度大于3位)"
                  prefix-icon="User"
                  size="large"
                />
              </el-form-item>
              
              <el-form-item prop="email">
                <el-input
                  v-model="doctorRegisterForm.email"
                  placeholder="请输入邮箱"
                  prefix-icon="Message"
                  size="large"
                />
              </el-form-item>
              
              <el-form-item prop="realName">
                <el-input
                  v-model="doctorRegisterForm.realName"
                  placeholder="请输入医生姓名"
                  prefix-icon="User"
                  size="large"
                />
              </el-form-item>
              
              <el-form-item prop="phone">
                <el-input
                  v-model="doctorRegisterForm.phone"
                  placeholder="请输入联系电话"
                  prefix-icon="Phone"
                  size="large"
                />
              </el-form-item>
              
              <el-form-item prop="gender">
                <el-select
                  v-model="doctorRegisterForm.gender"
                  placeholder="请选择性别"
                  size="large"
                  style="width: 100%"
                >
                  <el-option label="男" value="男" />
                  <el-option label="女" value="女" />
                </el-select>
              </el-form-item>
              

              
              <el-form-item prop="practiceScope">
                <el-select
                  v-model="doctorRegisterForm.practiceScope"
                  placeholder="请选择执业范围"
                  size="large"
                  style="width: 100%"
                >
                  <el-option label="内科" value="内科" />
                  <el-option label="外科" value="外科" />
                  <el-option label="儿科" value="儿科" />
                  <el-option label="妇产科" value="妇产科" />
                  <el-option label="眼科" value="眼科" />
                  <el-option label="耳鼻喉科" value="耳鼻喉科" />
                  <el-option label="皮肤科" value="皮肤科" />
                  <el-option label="神经科" value="神经科" />
                  <el-option label="精神科" value="精神科" />
                  <el-option label="急诊科" value="急诊科" />
                  <el-option label="其他" value="其他" />
                </el-select>
              </el-form-item>
              
              <el-form-item prop="hospitalName">
                <el-select
                  v-model="doctorRegisterForm.hospitalName"
                  placeholder="请选择所属医院"
                  size="large"
                  style="width: 100%"
                  :loading="hospitalLoading"
                >
                  <el-option 
                    v-for="hospital in hospitalList" 
                    :key="hospital" 
                    :label="hospital" 
                    :value="hospital" 
                  />
                </el-select>
              </el-form-item>
              
              <el-form-item prop="newPassword">
                <el-input
                  v-model="doctorRegisterForm.newPassword"
                  type="password"
                  placeholder="请输入密码 (6-15位)"
                  prefix-icon="Lock"
                  size="large"
                  show-password
                />
              </el-form-item>
              
              <el-form-item prop="confirmPassword">
                <el-input
                  v-model="doctorRegisterForm.confirmPassword"
                  type="password"
                  placeholder="请确认密码"
                  prefix-icon="Lock"
                  size="large"
                  show-password
                />
              </el-form-item>
              
              <el-form-item>
                <el-button
                  type="primary"
                  size="large"
                  class="login-button"
                  :loading="loading"
                  @click="handleDoctorRegister"
                >
                  注册
                </el-button>
              </el-form-item>
            </el-form>
          </el-tab-pane>
          
          <el-tab-pane label="密码找回" name="reset">
            <!-- 步骤提示 -->
            <div class="reset-step">
              <div class="reset-step-title">
                {{ resetStep === 1 ? '第一步：验证用户名' : 
                   resetStep === 2 ? '第二步：验证邮箱验证码' : 
                   '第三步：设置新密码' }}
              </div>
              <div class="reset-step-content">
                {{ resetStep === 1 ? '请输入您的用户名，系统将验证身份并获取关联的邮箱地址' : 
                   resetStep === 2 ? '验证码已发送到您的邮箱，请输入验证码进行身份验证' : 
                   '验证通过，请设置新的登录密码' }}
              </div>
            </div>
            
            <el-form
              ref="doctorResetFormRef"
              :model="doctorResetForm"
              :rules="doctorResetRules"
              class="login-form"
              @submit.prevent="handleDoctorReset"
            >
              <!-- 第一步：输入用户名 -->
              <el-form-item prop="username">
                <el-input
                  v-model="doctorResetForm.username"
                  placeholder="请输入用户名"
                  prefix-icon="User"
                  size="large"
                  :disabled="resetStep > 1"
                />
              </el-form-item>
              
              <!-- 用户名验证按钮 -->
              <el-form-item v-if="resetStep === 1">
                <el-button
                  type="primary"
                  size="large"
                  class="login-button"
                  :loading="loading"
                  @click="verifyUsername"
                >
                  验证用户名
                </el-button>
              </el-form-item>
              
              <!-- 第二步：显示邮箱和发送验证码 -->
              <template v-if="resetStep >= 2">
                <el-form-item>
                  <el-input
                    v-model="doctorResetForm.email"
                    placeholder="邮箱地址"
                    prefix-icon="Message"
                    size="large"
                    disabled
                  >
                    <template #prepend>邮箱：</template>
                  </el-input>
                </el-form-item>
                
                <el-form-item prop="emailCode">
                  <div class="code-input">
                    <el-input
                      v-model="doctorResetForm.emailCode"
                      placeholder="请输入邮箱验证码"
                      prefix-icon="Key"
                      size="large"
                    />
                    <el-button
                      type="primary"
                      size="large"
                      :disabled="countdown > 0"
                      @click="sendCode"
                    >
                      {{ countdown > 0 ? `${countdown}s` : '发送验证码' }}
                    </el-button>
                  </div>
                </el-form-item>
                
                <!-- 验证码验证按钮 -->
                <el-form-item v-if="resetStep === 2">
                  <div style="display: flex; gap: 10px;">
                    <el-button
                      type="primary"
                      size="large"
                      class="login-button"
                      :loading="loading"
                      @click="handleVerifyEmailCode"
                    >
                      验证验证码
                    </el-button>
                    <el-button
                      type="default"
                      size="large"
                      @click="resetStep = 1"
                    >
                      返回上一步
                    </el-button>
                  </div>
                </el-form-item>
              </template>
              
              <!-- 第三步：输入新密码 -->
              <template v-if="resetStep >= 3">
                <el-form-item prop="newPassword">
                  <el-input
                    v-model="doctorResetForm.newPassword"
                    type="password"
                    placeholder="请输入新密码 (6-15位)"
                    prefix-icon="Lock"
                    size="large"
                    show-password
                  />
                </el-form-item>
                
                <el-form-item prop="confirmPassword">
                  <el-input
                    v-model="doctorResetForm.confirmPassword"
                    type="password"
                    placeholder="请确认新密码"
                    prefix-icon="Lock"
                    size="large"
                    show-password
                  />
                </el-form-item>
                
                <el-form-item>
                  <div style="display: flex; gap: 10px;">
                    <el-button
                      type="primary"
                      size="large"
                      class="login-button"
                      :loading="loading"
                      @click="handleDoctorReset"
                    >
                      重置密码
                    </el-button>
                    <el-button
                      type="default"
                      size="large"
                      @click="resetStep = 2"
                    >
                      返回上一步
                    </el-button>
                  </div>
                </el-form-item>
              </template>
            </el-form>
          </el-tab-pane>
        </el-tabs>
      </div>
      
      <!-- 管理员登录表单 -->
      <div v-else>
        <el-form
          ref="adminLoginFormRef"
          :model="adminLoginForm"
          :rules="adminLoginRules"
          class="login-form"
          @submit.prevent="handleAdminLogin"
        >
          <el-form-item prop="username">
            <el-input
              v-model="adminLoginForm.username"
              placeholder="请输入用户名"
              prefix-icon="User"
              size="large"
            />
          </el-form-item>
          
          <el-form-item prop="password">
            <el-input
              v-model="adminLoginForm.password"
              type="password"
              placeholder="请输入密码"
              prefix-icon="Lock"
              size="large"
              show-password
              @keyup.enter="handleAdminLogin"
            />
          </el-form-item>
          
          <el-form-item>
            <el-button
              type="primary"
              size="large"
              class="login-button"
              :loading="loading"
              @click="handleAdminLogin"
            >
              登录
            </el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { adminLogin } from '../api/admin'
import { 
  doctorLogin, 
  doctorRegister, 
  sendEmailCode, 
  resetPassword,
  getDoctorInfoForReset,
  getEmailByUsername,
  verifyEmailCode,
  getHospitals
} from '../api/doctor'

const router = useRouter()
const loading = ref(false)
const isDoctor = ref(false)
const activeTab = ref('login')
const countdown = ref(0)
let countdownTimer = null
const resetStep = ref(1) // 1: 输入用户名, 2: 发送验证码, 3: 输入新密码
const hospitalLoading = ref(false)
const hospitalList = ref([])

// 医生登录表单
const doctorLoginFormRef = ref()
const doctorLoginForm = reactive({
  username: '',
  password: ''
})

// 医生注册表单
const doctorRegisterFormRef = ref()
const doctorRegisterForm = reactive({
  username: '',
  email: '',
  newPassword: '',
  confirmPassword: '',
  realName: '',
  phone: '',
  gender: '',
  practiceScope: '',
  hospitalName: ''
})

// 医生密码重置表单
const doctorResetFormRef = ref()
const doctorResetForm = reactive({
  username: '',
  email: '',
  emailCode: '',
  newPassword: '',
  confirmPassword: ''
})

// 管理员登录表单
const adminLoginFormRef = ref()
const adminLoginForm = reactive({
  username: '',
  password: ''
})

// 表单验证规则
const doctorLoginRules = {
  username: [
    { required: true, message: '请输入用户名', trigger: 'blur' }
  ],
  password: [
    { required: true, message: '请输入密码', trigger: 'blur' }
  ]
}

const doctorRegisterRules = {
  username: [
    { required: true, message: '请输入用户名', trigger: 'blur' },
    { min: 3, message: '用户名长度必须大于3位', trigger: 'blur' }
  ],
  email: [
    { required: true, message: '请输入邮箱', trigger: 'blur' },
    { type: 'email', message: '请输入正确的邮箱格式', trigger: 'blur' }
  ],
  newPassword: [
    { required: true, message: '请输入密码', trigger: 'blur' },
    { min: 6, max: 15, message: '密码长度必须在6-15位之间', trigger: 'blur' }
  ],
  confirmPassword: [
    { required: true, message: '请确认密码', trigger: 'blur' },
    {
      validator: (rule, value, callback) => {
        if (value !== doctorRegisterForm.newPassword) {
          callback(new Error('两次输入的密码不一致'))
        } else {
          callback()
        }
      },
      trigger: 'blur'
    }
  ],
  realName: [
    { required: true, message: '医生姓名不能为空', trigger: 'blur' }
  ],
  phone: [
    { required: true, message: '联系电话不能为空', trigger: 'blur' }
  ],
  gender: [
    { required: true, message: '性别不能为空', trigger: 'blur' }
  ],

  practiceScope: [
    { required: true, message: '执业范围不能为空', trigger: 'blur' }
  ],
  hospitalName: [
    { required: true, message: '请选择所属医院', trigger: 'change' }
  ]
}

const doctorResetRules = {
  username: [
    { required: true, message: '请输入用户名', trigger: 'blur' }
  ],
  emailCode: [
    { required: true, message: '请输入验证码', trigger: 'blur' }
  ],
  newPassword: [
    { required: true, message: '请输入新密码', trigger: 'blur' },
    { min: 6, max: 15, message: '密码长度必须在6-15位之间', trigger: 'blur' }
  ],
  confirmPassword: [
    { required: true, message: '请确认新密码', trigger: 'blur' },
    {
      validator: (rule, value, callback) => {
        if (value !== doctorResetForm.newPassword) {
          callback(new Error('两次输入的密码不一致'))
        } else {
          callback()
        }
      },
      trigger: 'blur'
    }
  ]
}

const adminLoginRules = {
  username: [
    { required: true, message: '请输入用户名', trigger: 'blur' }
  ],
  password: [
    { required: true, message: '请输入密码', trigger: 'blur' }
  ]
}

// 重置所有表单
const resetAllForms = () => {
  // 重置医生登录表单
  if (doctorLoginFormRef.value) {
    doctorLoginFormRef.value.resetFields()
  }
  
  // 重置医生注册表单
  if (doctorRegisterFormRef.value) {
    doctorRegisterFormRef.value.resetFields()
  }
  
  // 重置医生密码重置表单
  if (doctorResetFormRef.value) {
    doctorResetFormRef.value.resetFields()
  }
  
  // 重置管理员登录表单
  if (adminLoginFormRef.value) {
    adminLoginFormRef.value.resetFields()
  }
  
  // 重置倒计时
  if (countdownTimer) {
    clearInterval(countdownTimer)
    countdown.value = 0
  }
  
  // 重置密码找回步骤
  resetStep.value = 1
}

// 获取医院列表
const fetchHospitalList = async () => {
  try {
    hospitalLoading.value = true
    const response = await getHospitals()
    if (response.code === 200) {
      hospitalList.value = response.data.hospitals || []
    } else {
      ElMessage.error(response.message || '获取医院列表失败')
    }
  } catch (error) {
    console.error('获取医院列表失败:', error)
    ElMessage.error('获取医院列表失败，请检查网络连接')
  } finally {
    hospitalLoading.value = false
  }
}

// 切换功能
const switchToDoctor = () => {
  isDoctor.value = true
  activeTab.value = 'login'
  resetAllForms()
  // 切换到医生模式时获取医院列表
  fetchHospitalList()
}

const switchToAdmin = () => {
  isDoctor.value = false
  activeTab.value = 'login'
  resetAllForms()
}

// 切换标签页时重置密码找回步骤
const handleTabChange = (tabName) => {
  if (tabName === 'reset') {
    resetStep.value = 1
  }
}


// 发送验证码
const sendCode = async () => {
  if (!doctorResetForm.username || !doctorResetForm.email) {
    ElMessage.warning('请先验证用户名')
    return
  }
  
  try {
    loading.value = true
    const response = await sendEmailCode({
      email: doctorResetForm.email,
      username: doctorResetForm.username
    })
    
    if (response.code === 200) {
      ElMessage.success('验证码已发送到您的邮箱')
      startCountdown()
    } else {
      ElMessage.error(response.message || '发送失败')
    }
  } catch (error) {
    console.error('发送验证码失败:', error)
    ElMessage.error(error.response?.data?.message || '发送失败，请检查网络连接')
  } finally {
    loading.value = false
  }
}

// 开始倒计时
const startCountdown = () => {
  countdown.value = 60
  countdownTimer = setInterval(() => {
    countdown.value--
    if (countdown.value <= 0) {
      clearInterval(countdownTimer)
    }
  }, 1000)
}

// 验证用户名
const verifyUsername = async () => {
  if (!doctorResetFormRef.value) return
  
  try {
    await doctorResetFormRef.value.validateField('username')
    loading.value = true
    
    const response = await getEmailByUsername(doctorResetForm.username)
    
    if (response.code === 200) {
      doctorResetForm.email = response.data.email
      ElMessage.success('用户名验证成功，请发送验证码')
      resetStep.value = 2 // 进入第二步
    } else {
      ElMessage.error(response.message || '用户名验证失败')
    }
  } catch (error) {
    console.error('验证用户名失败:', error)
    ElMessage.error(error.response?.data?.message || '验证失败，请检查网络连接')
  } finally {
    loading.value = false
  }
}

// 验证邮箱验证码
const handleVerifyEmailCode = async () => {
  if (!doctorResetFormRef.value) return
  
  try {
    await doctorResetFormRef.value.validateField('emailCode')
    loading.value = true
    
    // 调用验证验证码接口
    const response = await verifyEmailCode({
      username: doctorResetForm.username,
      email: doctorResetForm.email,
      emailCode: doctorResetForm.emailCode
    })
    
    if (response.code === 200) {
      ElMessage.success('验证码验证成功，请设置新密码')
      resetStep.value = 3 // 进入第三步
    } else {
      ElMessage.error(response.message || '验证码验证失败')
    }
  } catch (error) {
    console.error('验证验证码失败:', error)
    ElMessage.error(error.response?.data?.message || '验证码验证失败')
  } finally {
    loading.value = false
  }
}

// 医生登录
const handleDoctorLogin = async () => {
  if (!doctorLoginFormRef.value) return
  
  try {
    await doctorLoginFormRef.value.validate()
    loading.value = true
    
    const response = await doctorLogin(doctorLoginForm)
    
    if (response.code === 200) {
      const { token, doctor } = response.data
      
      // 保存登录信息
      localStorage.setItem('doctorToken', token)
      localStorage.setItem('doctorInfo', JSON.stringify(doctor))
      
      ElMessage.success('登录成功')
      
      // 跳转到医生界面（需要创建）
      router.push('/doctor-dashboard')
    } else {
      ElMessage.error(response.message || '登录失败')
    }
  } catch (error) {
    console.error('登录失败:', error)
    ElMessage.error(error.response?.data?.message || '登录失败，请检查网络连接')
  } finally {
    loading.value = false
  }
}

// 医生注册
const handleDoctorRegister = async () => {
  if (!doctorRegisterFormRef.value) return
  
  try {
    await doctorRegisterFormRef.value.validate()
    loading.value = true
    
    // 构建注册数据，确保包含所有必要字段
    const registerData = {
      username: doctorRegisterForm.username,
      email: doctorRegisterForm.email,
      password: doctorRegisterForm.newPassword,
      confirmPassword: doctorRegisterForm.confirmPassword,
      realName: doctorRegisterForm.realName,
      phone: doctorRegisterForm.phone,
      gender: doctorRegisterForm.gender === '男' ? 1 : 2, // 转换为整数类型：1-男，2-女
      practiceScope: doctorRegisterForm.practiceScope,
      hospitalName: doctorRegisterForm.hospitalName
    }
    
    const response = await doctorRegister(registerData)
    
    if (response.code === 200) {
      const { token, doctor } = response.data
      
      ElMessage.success('注册成功')
      
      // 保存登录信息并跳转
      localStorage.setItem('doctorToken', token)
      localStorage.setItem('doctorInfo', JSON.stringify(doctor))
      router.push('/doctor-dashboard')
    } else {
      ElMessage.error(response.message || '注册失败')
    }
  } catch (error) {
    console.error('注册失败:', error)
    ElMessage.error(error.response?.data?.message || '注册失败，请检查网络连接')
  } finally {
    loading.value = false
  }
}

// 医生密码重置
const handleDoctorReset = async () => {
  if (!doctorResetFormRef.value) return
  
  try {
    await doctorResetFormRef.value.validate()
    loading.value = true
    
    const response = await resetPassword(doctorResetForm)
    
    if (response.code === 200) {
      ElMessage.success('密码重置成功，请使用新密码登录')
      activeTab.value = 'login'
      resetAllForms()
    } else {
      ElMessage.error(response.message || '密码重置失败')
    }
  } catch (error) {
    console.error('密码重置失败:', error)
    ElMessage.error(error.response?.data?.message || '密码重置失败，请检查网络连接')
  } finally {
    loading.value = false
  }
}

// 管理员登录
const handleAdminLogin = async () => {
  if (!adminLoginFormRef.value) return
  
  try {
    await adminLoginFormRef.value.validate()
    loading.value = true
    
    const response = await adminLogin(adminLoginForm)
    
    if (response.code === 200) {
      const { token, admin } = response.data
      
      // 保存登录信息
      localStorage.setItem('adminToken', token)
      localStorage.setItem('level', admin.level.toString())
      localStorage.setItem('adminInfo', JSON.stringify(admin))
      
      ElMessage.success('登录成功')
      
      // 根据管理员级别跳转
      if (admin.level === 2) {
        router.push('/super-admin')
      } else {
        router.push('/normal-admin')
      }
    } else {
      ElMessage.error(response.message || '登录失败')
    }
  } catch (error) {
    console.error('登录失败:', error)
    ElMessage.error(error.response?.data?.message || '登录失败，请检查网络连接')
  } finally {
    loading.value = false
  }
}

// 组件卸载时清理定时器
onUnmounted(() => {
  if (countdownTimer) {
    clearInterval(countdownTimer)
  }
})
</script>

<style scoped>
.login-container {
  min-height: 100vh;
  background: url('/src/static/images/docker.png') no-repeat center center;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.login-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 1;
  backdrop-filter: blur(1px);
}

.login-box {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  padding: 45px;
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 2;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.login-box {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  padding: 40px;
  width: 100%;
  max-width: 450px;
}

.login-header {
  text-align: center;
  margin-bottom: 35px;
  padding: 20px 0;
}

.login-header h2 {
  color: #2c3e50;
  margin-bottom: 12px;
  font-size: 28px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.login-header p {
  color: #5a6c7d;
  font-size: 16px;
  margin-bottom: 22px;
  font-weight: 500;
  line-height: 1.5;
}

.switch-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 15px;
}

.switch-container .el-button {
  border-radius: 20px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.switch-container .el-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.switch-container .el-button--primary {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.login-tabs {
  margin-bottom: 24px;
}

:deep(.el-tabs__header) {
  margin-bottom: 0;
}

:deep(.el-tabs__nav) {
  border-radius: 8px;
  background: rgba(248, 249, 250, 0.5);
  padding: 4px;
}

.login-form {
  width: 100%;
}

.login-button {
  width: 100%;
  height: 50px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  border: none;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
  transition: all 0.3s ease;
  letter-spacing: 1px;
}

.login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.login-button:active {
  transform: translateY(0);
}

.el-form-item {
  margin-bottom: 24px;
}

.el-form-item__content {
  line-height: 1.5;
}

.el-input {
  border-radius: 12px;
}

:deep(.el-input__wrapper) {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

:deep(.el-input__wrapper:hover) {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border-color: #4CAF50;
}

:deep(.el-input__wrapper.is-focus) {
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
  border-color: #4CAF50;
}

.code-input {
  display: flex;
  gap: 12px;
  align-items: center;
}

.code-input .el-input {
  flex: 1;
}

.code-input .el-button {
  flex-shrink: 0;
  width: 120px;
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.code-input .el-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 密码找回步骤样式 */
.reset-step {
  margin-bottom: 20px;
  padding: 20px;
  border-radius: 12px;
  background: rgba(248, 249, 250, 0.9);
  border-left: 4px solid #4CAF50;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.reset-step-title {
  font-weight: 600;
  color: #4CAF50;
  margin-bottom: 10px;
  font-size: 16px;
}

.reset-step-content {
  color: #5a6c7d;
  line-height: 1.6;
}

:deep(.el-tabs__nav-wrap) {
  justify-content: center;
}

:deep(.el-tabs__item) {
  font-size: 16px;
  padding: 0 20px;
  font-weight: 500;
  color: #5a6c7d;
}

:deep(.el-tabs__item.is-active) {
  color: #4CAF50;
  font-weight: 600;
}

:deep(.el-tabs__active-bar) {
  background-color: #4CAF50;
  height: 3px;
  border-radius: 2px;
}
</style> 